package com.patterns.templateMethod.hummerModle2;

/**
 * Created by Xiao Yiyun on 2017/4/19.
 */
public class HummerH1 extends HummerModel {
    public void start() {
        System.out.println("H1启动。。。。。。。。");
    }

    public void stop() {
        System.out.println("H1停车。。。。。。。。");
    }

    public void alarm() {
        System.out.println("H1鸣笛。。。。。。。。");
    }

    public void engine() {
        System.out.println("H1轰鸣。。。。。。。。");
    }

    //客户端通过设定alarmFlag的值确定是否要鸣笛
    //默认为TRUE
    private boolean alarmFlag = true;
    protected void setAlarmFlag(boolean alarmFlag) {
        this.alarmFlag = alarmFlag;
    }
    //重写该方法，使父类进行判断时受子类属性的影响
    //TRUE 鸣笛
    //FALSE 不鸣笛
    protected boolean isAlarm() {
        return this.alarmFlag;
    }
}